package com.atguigu.flink.datastreamapi.source;


import com.atguigu.flink.function.MySourceFunction;
import com.atguigu.flink.function.WaterSensorMapFunction;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Demo5_CustomSource
{

    //定义一个类，功能必须是Source。
    // Source必须是SourceFunction类型
    public static void main(String[] args) {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        //获取自定义的Source
        env.addSource(new MySourceFunction()).setParallelism(10)
           .print();


                try {
                            env.execute();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

    }

}
